package com.lx.config;

import org.springframework.beans.factory.annotation.Autowired;
import weixin.popular.support.TicketManager;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 初始化tocken（javaAPI调用）
 * @author lixing
 * @date 2021/5/25 10:14
 */
public class TickenManagerListener implements ServletContextListener {
    @Autowired
    private WxConfig wxConfig;

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        TicketManager.init(wxConfig.getAppID(),wxConfig.getAppsecret());
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        TicketManager.destroyed();
    }
}
